home *** CD-ROM | disk | FTP | other *** search
/ Enter 2006 October / Enter 10 2006.iso / boot / isolinux / initrd / in / etc / rc.d / rc.udev < prev   
Encoding:
Text File  |  2006-05-14  |  1.7 KB  |  84 lines

  1. #!/bin/sh
  2. # Start/stop/restart the UDEV service
  3. #
  4. # This is a init script for the udevd server.
  5. # udev creates dynamically the files under /dev.
  6.  
  7.  
  8. PATH="/sbin:/bin"
  9.  
  10. case "$1" in
  11.     start)
  12.     # disable hotplug helper, udevd listens to netlink
  13.     echo "" > /proc/sys/kernel/hotplug
  14.  
  15.     # mount tmpfs on /dev
  16.     if ! grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then
  17.         # umount shm if needed
  18.         if grep -E -q "^[^[:space:]]+ /dev/shm tmpfs" /proc/mounts; then
  19.         umount -l /dev/shm
  20.         fi
  21.  
  22.         # umount pts if needed, will remount it
  23.         if grep -E -q "^[^[:space:]]+ /dev/pts devpts" /proc/mounts; then
  24.         umount -n -l /dev/pts
  25.         fi
  26.  
  27.         # mount tmpfs on /dev
  28.         mount -n -o mode=0755 -t tmpfs tmpfs /dev
  29.  
  30.         # we are on tmpfs anyway
  31.         mkdir /dev/shm
  32.  
  33.         # remount pts
  34.         mkdir /dev/pts
  35.         mount -n -o mode=0620,gid=5 -t devpts devpts /dev/pts
  36.     fi
  37.  
  38.     # populate initial /dev with the static nodes
  39.     cp -R -p -f /lib/udev/devices/* /dev
  40.  
  41.     # start udevd
  42.     echo "Starting UDEV daemon..."
  43.     /sbin/udevd --daemon 1>/dev/null 2>/dev/null     
  44.  
  45.     # generate events with the sysfs trigger
  46.     mkdir -p /dev/.udev/queue
  47.     /sbin/udevtrigger
  48.  
  49.     udevd_timeout=20
  50.         while test -d /dev/.udev/queue; do
  51.         sleep 2 
  52.         udevd_timeout=$(($udevd_timeout - 1))
  53.         if [ $udevd_timeout -eq 0 ]; then
  54.         break
  55.          fi 
  56.         done
  57.     sleep 5
  58.     
  59.     ;;
  60.     stop)
  61.     echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
  62.     killall udevd 
  63.     ;;
  64.     restart)
  65.     killall udevd
  66.     sleep 5
  67.     udevd --daemon
  68.     ;;
  69.     reload)
  70.     udevcontrol reload_rules
  71.     cp -R -p -f /lib/udev/devices/* /dev
  72.     ;;
  73.     force-reload)
  74.     udevcontrol reload_rules
  75.     rm -rf /dev/.udev /dev/disk
  76.     cp -R -p -f /lib/udev/devices/* /dev
  77.     ;;
  78.     
  79.     *)
  80.     echo "Usage: $0 {start|stop|restart|reload|force-reload}"
  81.     exit 1
  82.     ;;
  83. esac
  84.